package code.wrtp;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;

import code.wrtp.typeofcell.CellOfListened;
import code.wrtp.typeofcell.CellOfRing;

public class Node {
	
	private short nodeID;
	private short predecessor;
	private short successor;
	private short varalPredecessor;
	private short varalSuccessor;
	private short RA;   /*Ring address*/
	private short VA;   /*Varal address*/
	private boolean amCoordinator;
	private State state;
	private State previousState;
	private short priority;
	private long genCnt; /* Generation counting */
	private long coordCnt; /* Coordination counting */
	private Collection<Short> IDList;
	private Collection<CellOfListened> listenedNodesTable;
	private Collection<CellOfRing> myRingNodesConnectivityTable;
	private Collection<CellOfRing> myVaralNodesConnectivityTable;
	
	public Node(short nodeID) {
		this.nodeID = nodeID;
		IDList = new HashSet<Short>();
		listenedNodesTable = new HashSet<CellOfListened>();
		myRingNodesConnectivityTable = new ArrayList<CellOfRing>();
		myVaralNodesConnectivityTable = new ArrayList<CellOfRing>();
	}

	public short getNodeID() {
		return nodeID;
	}

	public short getPredecessor() {
		return predecessor;
	}

	public void setPredecessor(short predecessor) {
		this.predecessor = predecessor;
	}

	public short getSuccessor() {
		return successor;
	}

	public void setSuccessor(short successor) {
		this.successor = successor;
	}

	public short getVaralPredecessor() {
		return varalPredecessor;
	}

	public void setVaralPredecessor(short varalPredecessorID) {
		this.varalPredecessor = varalPredecessorID;
	}

	public short getVaralSuccessor() {
		return varalSuccessor;
	}

	public void setVaralSuccessor(short varalSuccessor) {
		this.varalSuccessor = varalSuccessor;
	}

	public short getRA() {
		return RA;
	}

	public void setRA(short rA) {
		RA = rA;
	}

	public short getVA() {
		return VA;
	}

	public void setVA(short vA) {
		VA = vA;
	}

	public boolean isAmCoordinator() {
		return amCoordinator;
	}

	public void setAmCoordinator(boolean amCoordinator) {
		this.amCoordinator = amCoordinator;
	}

	public State getState() {
		return state;
	}

	public void setState(State state) {
		this.state = state;
	}

	public State getPreviousState() {
		return previousState;
	}

	public void setPreviousState(State previousState) {
		this.previousState = previousState;
	}

	public short getPriority() {
		return priority;
	}

	public void setPriority(short priority) {
		this.priority = priority;
	}

	public long getGenCnt() {
		return genCnt;
	}

	public void setGenCnt(long genCnt) {
		this.genCnt = genCnt;
	}

	public long getCoordCnt() {
		return coordCnt;
	}

	public void setCoordCnt(long coordCnt) {
		this.coordCnt = coordCnt;
	}

	public Collection<Short> getIDList() {
		return IDList;
	}

	public Collection<CellOfListened> getListenedNodesTable() {
		return listenedNodesTable;
	}

	public Collection<CellOfRing> getMyRingNodesConnectivityTable() {
		return myRingNodesConnectivityTable;
	}

	public Collection<CellOfRing> getMyVaralNodesConnectivityTable() {
		return myVaralNodesConnectivityTable;
	}	
}
